#ifndef TOKENSMODEL_H
#define TOKENSMODEL_H

#include <QAbstractItemModel>
#include "gelement.h"

class TokensModel : public QAbstractItemModel
{
	Q_OBJECT

public:
	TokensModel(GElement* ele, QObject *parent);
	~TokensModel();

	QModelIndex append(Token* newToken);
	void deleteAt(const QModelIndex & index);

	void setTrace(const QModelIndex & index, const QStack<Trace> & trace);

	void moveUp(const QModelIndex & index);

	virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
	virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
	virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
	virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
	virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
	virtual QModelIndex parent ( const QModelIndex & index ) const;

	virtual Qt::ItemFlags flags(const QModelIndex &index) const;
	virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );

private:
	GElement* const mElement;
	
};

#endif // TOKENSMODEL_H
